import { ApiCall } from "tsrpc";
import { ReqGetOneExpById, ResGetOneExpById } from "../../shared/protocols/Experiment/PtlGetOneExpById";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqGetOneExpById, ResGetOneExpById>) {
    // TODO
    const expId = call.req.expId

    const ret = await Global.collection('experiments').findOne({
        _id:expId
    })
    if(!ret) return call.error('实验不存在')

    call.succ({
        exp:ret
    })
}